The bacterial flagellar motor (BFM) and the Fo motor (FoM) of ATP synthase are the only known rotary protein motors driven by transmembrane ion potentials. The flagellar motor is the organelle of locomotion in many bacterial species, while the FoM drives the synthesis of ATP, the universal cell fuel. Both proteins play a fundamental role in the lives of cells. The mathematical models developed until now describe the functioning of the motors phenomenologically. That is, the interactions between the stators and the rotor are treated by constructing driving potentials that are artificially tuned to fit the measured behavior This is good enough in the absence of a detailed molecular structure. However, recent experiments have elucidated many of the component structures of these motors to the point where we can address directly how intermolecular forces conspire to generate the rotary torques. A structure-based model will provide an explanation for how transmembrane ion potentials are converted into rotary torque, and how the binding of CheYP to the rotor reverses the torque. This process controls the alter- nation of 'runs' and 'tumbles' of the bacterium, which is the basis of its chemotaxis. In Aim 1, we will address the physical mechanism by which torque is generated by the stator of the BFM using the available structural information of the stator and rotor proteins. This work is based on the 'proline hinge' mechanism proposed by D. Blair as the power-stroke driving the rotation of the flagellar motor. This mechanism is based on the bending of the ?-helices constituting the stator induced by a proline residue. Thus, when a cation hops onto the ion-binding site of the stator, the hydrogen bonds in the vicinity of the site rearrange thereby inducing a 'kink and swivel' movement of the ?-helix about the proline residue. Existing molecular dynamics simulations, supported by our energy-based calculations, show that this is an energetically plausible mechanism. In this work we will develop mathematical models describing the power-stroke mechanism and focus on explaining the following experiments: (i) degradation of motor efficiency due to mutation of important charges on the stator and the rotor, (ii) torque-speed curves, (iii) step-size distributions, and (iv) motor reversals. Our studies of te flagellar motor have convinced us to revisit our previously published models of the Fo motor. In Aim 2, we show that the electrostatic power stroke mechanism we proposed previously should be re- placed by a conformation power stroke that is structurally similar to the proline hinge mechanism in the flagellar motor. Using this new mechanism we will address a number of unresolved issues in powering rotation of the FoM. These studies will present a unified mechanochemical mechanism for both the rotary motors and may help in understanding how they are related from the viewpoint of their evolution.